package myicesscheduler.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

public class TimeSlotReservationCommandValidator implements Validator
{
   protected final Log logger = LogFactory.getLog( getClass() );

   @SuppressWarnings( "unchecked" )
   public boolean supports( Class clazz )
   {
      return TimeSlotReservationCommand.class.equals( clazz );
   }

   public void validate( Object obj, Errors errors )
   {
      final TimeSlotReservationCommand cmd = (TimeSlotReservationCommand) obj;
      if( null == cmd )
      {
         errors.reject( "Null command object" );
         return;
      }

      logger.info( cmd.toString() );
//    logger.info( reserveTimeSlot.getLecture() );
   }
}
